<template>
  <view class="xmain">
    <headBar title="提现"></headBar>
    <view class="center">
      <view class="wiTab" @click="x_redirect('/pages/coins/coins')">
        <view>当前金币</view>
        <view style="margin-top:20rpx;">{{userInfo.coins}}（≈{{money}}元）</view>
      </view>
      <view style="height:40rpx;background: #f8f8f8;"></view>
      <view class="moneyTab">
        <view>微信提现</view>
        <view>
          <view class="uni-flex uni-row moneyBox">
            <view class="flex-item " :class="moneyIndex == 5?'moneyBoxActive':''" @click="moneyIndex=5">5元</view>
            <view class="flex-item"  :class="moneyIndex == 10?'moneyBoxActive':''" @click="moneyIndex=10">10元</view>
            <view class="flex-item"  :class="moneyIndex == 15?'moneyBoxActive':''" @click="moneyIndex=15">15元</view>
          </view>
          <view class="uni-flex uni-row moneyBox">
            <view class="flex-item"  :class="moneyIndex == 20?'moneyBoxActive':''" @click="moneyIndex=20">20元</view>
            <view class="flex-item"  :class="moneyIndex == 25?'moneyBoxActive':''" @click="moneyIndex=25">25元</view>
            <view class="flex-item"  :class="moneyIndex == 30?'moneyBoxActive':''" @click="moneyIndex=30">30元</view>
          </view>
        </view>
      </view>
    </view>
    <view></view>
    <view>
      <button type="primary" @click="xsubmit()" class="witBtn">提交</button>
    </view>
    <bootNav nav="my"></bootNav>
  </view>
</template>

<script>
import x from '@/common/base.js';

export default {
  data() {
    return {
      userInfo: {
        avatar: '/static/user.png',
        nickName: '会员',
        coins:0
      },
      menuList: [],
      money:0,
      moneyIndex:0
    }
  },
  onReady: function () {
    this.getUserInfo();
    this.initMoney();
  },
  methods: {
    getUserInfo() {
      var t = this;
      var userInfo = x.getUserInfo(this);
      if(userInfo){
        t.userInfo = userInfo
      }
    },
    initMoney(){
      var t = this;
      var rate = 10000;
      if(t.userInfo.coins>0){
        t.money = (t.userInfo.coins/rate).toFixed(2);
      }
    },
    xsubmit(){
      uni.showToast({title: '提现金额不足', icon: 'error', duration: 2000})
    }
  }
}
</script>

<style lang="scss">
@import "./withdrawal.css";
</style>
